package cn.tedu.zhwy.community.controller;

import cn.tedu.zhwy.base.response.JsonResult;
import cn.tedu.zhwy.community.pojo.dto.ComplainParam;
import cn.tedu.zhwy.community.pojo.vo.ComplainVO;
import cn.tedu.zhwy.community.service.ComplainService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@Slf4j
@RestController
@RequestMapping("/v1/complain")
public class ComplainController {
    @Autowired
    ComplainService complainService;
    @GetMapping("/select")
    public JsonResult select(ComplainParam complainParam){
        log.debug("查询投诉信息={}", complainParam);
        log.debug("{}", complainParam.getLname());
        List<ComplainVO> list = complainService.select(complainParam);
        return JsonResult.ok(list);
    }
    @PostMapping("/update")
    public JsonResult update(ComplainParam complainParam){
        log.debug("修改投诉参数-{}",complainParam);
        complainService.update(complainParam);
        return JsonResult.ok();
    }
    @PostMapping("/delete/{cid}")
    public JsonResult delete(@PathVariable Integer cid){
        complainService.delete(cid);
        return JsonResult.ok();
    }
}
